#ifndef BUTTONGROUPCELL_H
#define BUTTONGROUPCELL_H

#include "CellBase.h"
#include "../QAbstractButton/ButtonGroup.h"

class ButtonGroupCell : public CellBase
{
    Q_OBJECT
public:
    /*
     * param = [{"name"=xxx,"title"=xxx}]
    */
    Q_INVOKABLE explicit ButtonGroupCell(QVariant param, QWidget *parent = nullptr);
    ~ButtonGroupCell();

    void updateData(const QVariant &data);
    void setData(const QVariant &data);
    CellBase* ctor(QWidget *parent = nullptr);

    void setActived(bool actived);

private:
    void polish();
    Q_SLOT void onClicked(QString name);

private:
    QVariant _param;
    ButtonGroup _buttonShell;
    QList<QAbstractButton*> _buttons;
};

#endif // BUTTONGROUPCELL_H
